package com.fms.gui.templateCreator.components.date;

import junit.framework.TestCase;

import com.fms.TestUtils;
import com.fms.gui.templateCreator.components.date.parts.TimeAngleCalculator;

public class TimeAngleCalculatorTest extends TestCase
{

	private TimeAngleCalculator c;
	protected void setUp() throws Exception
	{
		c = new TimeAngleCalculator();
		super.setUp();
	}

	protected void tearDown() throws Exception
	{
		super.tearDown();
	}
	
	public void testHourAngleCalculateNoon()
	{		
		assertTrue(TestUtils.aboutEqual(c.angleForHour(12, 0), 2 * Math.PI));
		assertTrue(TestUtils.aboutEqual(c.angleForHour(0, 0), 0));	
	}
	
	public void testHourAngleCalculateThree()
	{		
		assertTrue(TestUtils.aboutEqual(c.angleForHour(3, 0), Math.PI/2));	
	}
	
	public void testHourAngleCalculateSix()
	{		
		assertTrue(TestUtils.aboutEqual(c.angleForHour(6, 0), Math.PI));	
	}
	
	public void testHourAngleCalculateTenThirty()
	{		
		assertTrue(TestUtils.aboutEqual(c.angleForHour(10, 30), (7.0/4.0) * Math.PI));	
	}
	
	public void testGetHourFromVectorNoon()
	{		
		double[] position = new double[] { 0.0, 1.0};
		
		
		assertTrue(TestUtils.aboutEqual(c.hourFromVector(position), 0.0));	
	}
	
	public void testGetHourFromVectorThree()
	{		
		double[] position = new double[] { 1.0, 0.0};
		
		
		assertTrue(TestUtils.aboutEqual(c.hourFromVector(position), Math.PI/2));	
	}
	
	public void testGetHourFromVectorOneThirty()
	{		
		double[] position = new double[] { 1.0, 1.0};
		
		
		
		assertTrue(String.valueOf(Math.PI/4), 
				TestUtils.aboutEqual(c.hourFromVector(position), Math.PI/4));	
	}

}
